package cn.kgc.service.impl;

import cn.kgc.dao.StuAndProDao;
import cn.kgc.dao.impl.StuAndDaoImpl;
import cn.kgc.entity.StuAndPro;
import cn.kgc.service.StuAndProService;

import java.util.List;

public class StuAndProServiceImpl implements StuAndProService {
    @Override
    public List<StuAndPro> search(String stunum,String name,String specialty,int currentPage,int currentSize) {
        if("全部专业".equals(specialty)){
            specialty = null;
        }
        StuAndProDao stuAndProDao = new StuAndDaoImpl();
        List<StuAndPro> stuAndProDaoList = stuAndProDao.search(stunum,name,specialty,currentPage,currentSize);
        return stuAndProDaoList;
    }

    @Override
    public int totalCount(String stunum, String name, String specialty) {
        if("全部专业".equals(specialty)){
            specialty = null;
        }
        StuAndProDao stuAndProDao = new StuAndDaoImpl();
        return stuAndProDao.totalCount(stunum,name,specialty);
    }

    @Override
    public int totalPage(int pageSize, String stunum, String name, String specialty) {
        if("全部专业".equals(specialty)){
            specialty = null;
        }
        StuAndProDao stuAndProDao = new StuAndDaoImpl();
        return stuAndProDao.totalPage(pageSize,stunum,name,specialty);
    }
}
